package com.simple.common.exception;

import com.simple.framework.constant.HttpStatus;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @Description 业务异常
 * @Author xiaoke
 * @Date 2024/8/10 18:00
 * @Version 1.0
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class ServiceException extends RuntimeException {
    private static final long serialVersionUID = 1L;
    /**
     * 错误码
     */
    private Integer code;

    /**
     * 错误提示
     */
    private String message;
    /**
     * 空构造方法，避免反序列化问题
     */
    public ServiceException()
    {
    }
    public ServiceException(String message)
    {
        this.message = message;
        this.code = HttpStatus.BAD_REQUEST;
    }
    public ServiceException(String message, Integer code)
    {
        this.message = message;
        this.code = code;
    }
}
